package j2024.j202410;

import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;

public class j1019 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> arr = new ArrayList<>();
        for (int  i = 1;  i <= n;  i+=2) {
            arr.add(i);
        }
        while(arr.size()!=1){
            while(arr.get(0)==0){
                arr.remove(0);
            }
            int i = 1;
            while(i<=arr.size()){
                if(arr.get(i-1)==0){
                    arr.remove(i-1);
                    i++;continue;
                }
                if(i%2==1){
                    arr.set(i-1,0);
                }
                i+=2;
            }
        }
        System.out.println(arr.get(0));
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        PriorityQueue<int[]> ret = new PriorityQueue<>((a,b)->{
            return a[0]-b[0];
        });
        if(n>=m){
            ret.offer(new int[]{m});
        }
        int left = 1,right = n;
        while(left<right){
            if(left+right==m){
                ret.offer(new int[]{left,right});
            }else if(left+right<m){
                left++;
            }else{
                right--;
            }
        }
        while(!ret.isEmpty()){
            int[] tmp = ret.poll();
            if(tmp.length==1){
                System.out.println(tmp[0]);
            }else {
                System.out.println(tmp[0]+" "+tmp[1]);
            }
        }
    }


}
